/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.b2b.modules.fm.service.base;

import java.util.List;

import com.b2b.common.utils.StringUtils;
import com.b2b.modules.sys.entity.User;
import com.b2b.modules.sys.utils.AreaUtils;
import com.b2b.modules.sys.utils.OrgUtils;
import com.b2b.modules.sys.utils.UserUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.b2b.common.persistence.Page;
import com.b2b.common.service.CrudService;
import com.b2b.modules.fm.entity.base.FmStore;
import com.b2b.modules.fm.dao.base.FmStoreDao;

/**
 * 门店管理Service
 * @author soldier lee
 * @version 2016-11-15
 */
@Service
@Transactional(readOnly = true)
public class FmStoreService extends CrudService<FmStoreDao, FmStore> {

	public FmStore get(String id) {
		FmStore fmStore = super.get(id);
		if (StringUtils.isNotEmpty(fmStore.getArea())){
			fmStore.setArea(AreaUtils.getAreaById(fmStore.getArea().getId()));
			fmStore.setOrg(OrgUtils.getOfficeById(fmStore.getOrg().getId()));
			fmStore.setTeam(OrgUtils.getOfficeById(fmStore.getTeam().getId()));
			fmStore.setManager(UserUtils.get(fmStore.getManager().getId()));
			fmStore.setLeader(UserUtils.get(fmStore.getLeader().getId()));
		}

		return fmStore;
	}
	
	public List<FmStore> findList(FmStore fmStore) {
		return super.findList(fmStore);
	}
	
	public Page<FmStore> findPage(Page<FmStore> page, FmStore fmStore) {
		return super.findPage(page, fmStore);
	}
	
	@Transactional(readOnly = false)
	public void save(FmStore fmStore) {
		super.save(fmStore);
	}
	
	@Transactional(readOnly = false)
	public void delete(FmStore fmStore) {
		super.delete(fmStore);
	}
	
	
	
	
}